#include "choosemode.h"
#include "QPushButton"
#include "QLabel"
#include "gamescene.h"
#include "QDebug"
int numofplayer=1;

ChooseMode::ChooseMode(QWidget *parent) : QWidget(parent)
{
    this->setFixedSize(800,600);
    this->setWindowTitle("选择游戏人数");
    QLabel* text_players=new QLabel();
    text_players->setParent(this);
    text_players->setText("请选择游戏人数");
    text_players->move(100,100);
    one->setParent(this);
    one->setText("单人模式");
    one->move(180,200);
    two->setParent(this);
    two->setText("双人模式");
    two->move(480,200);
    three->setParent(this);
    three->setText("三人模式");
    three->move(180,350);
    four->setParent(this);
    four->setText("四人模式");
    four->move(480,350);
    //创建游戏窗口
    //GameScene* gamescene = new GameScene();
    //********进入游戏，设置游戏人数*******
    connect(one,&QPushButton::clicked,[=](){
        numofplayer=1;
        this->close();
        GameScene* gamescene = new GameScene();
        gamescene->show();
    });
    connect(two,&QPushButton::clicked,[=](){
        numofplayer=2;
        this->close();
        GameScene* gamescene = new GameScene();
        gamescene->show();
    });
    connect(three,&QPushButton::clicked,[=](){
        numofplayer=3;
        this->close();
        GameScene* gamescene = new GameScene();
        gamescene->show();
    });
    connect(four,&QPushButton::clicked,[=](){
        numofplayer=4;
        this->close();
        GameScene* gamescene = new GameScene();
        gamescene->show();
    });
    //********************
}

